package adv6;

public class Thread4 extends Thread {
	public Thread4(String n) {
		super(n);// n是线程的名字
	}

	@Override // 线程里干的活
	public void run() {
		for (int i = 1; i <= 20; i++) {
			System.out.println(super.getName() + ">>>" + i);
			super.yield();// 礼让
		}
	}

	public static void main(String[] args) {

		for (int i = 1; i <= 5; i++) {
			new Thread4("线程" + i).start();
		}
		System.out.println(Thread.currentThread().getName() + "主线程结束了");
	}
}
